package com.jerry.huihome.module.find_near_mine.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jerry.huihome.R;
import com.jerry.huihome.base.BaseApplication;
import com.jerry.huihome.base.BaseViewHolder;
import com.jerry.huihome.base.MyBaseAdapter;
import com.jerry.huihome.module.find_near_mine.entity.AfflatusItemEntity;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

import butterknife.BindView;

/**
 * Created by axiang on 2016/5/13.
 */
public class AfflatusItemAdapter extends MyBaseAdapter<AfflatusItemEntity.BodyBean.DetailItemsBean>{

    private final Context context;
    private final List<AfflatusItemEntity.BodyBean.DetailItemsBean> list;
    private final ImageLoader imageLoader;

    public AfflatusItemAdapter(Context context, List<AfflatusItemEntity.BodyBean.DetailItemsBean> list){
        super(context, list);
        this.context = context;
        this.list = list;
        imageLoader = BaseApplication.getApplication().getImageLoader();
    }

    @Override
    public int getLayoutId(){
        return R.layout.afflatus_clickepic_imageitem_list;
    }

    @Override
    public BaseViewHolder getViewHolder(){
        return new ViewHolder();
    }

    @Override
    public void bindViews(View view, BaseViewHolder viewHolder){
        ViewHolder holder = (ViewHolder) viewHolder;
        final AfflatusItemEntity.BodyBean.DetailItemsBean detailItemsBean
                =getItem(holder.position);
        String url = detailItemsBean.getListImg();
        imageLoader.displayImage(url,holder.image);
        holder.number.setText(holder.position+1+"");
        holder.detaelintro.setText(detailItemsBean.getDescription());

    }

    public class ViewHolder extends BaseViewHolder{
        @BindView(R.id.imagebig)
        ImageView image;
        @BindView(R.id.number)
        TextView number;
        @BindView(R.id.detaelintro)
        TextView detaelintro;
    }
}
